package Stream;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.stream.Stream;

class person {
    String name;

    public person() {
    }

    public person(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}

class Super{
    String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Super() {
    }

    public Super(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "Super{" +
                "name='" + name + '\'' +
                '}';
    }
}


public class test1 {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list.add("张三");
        list.add("张三风");
        list.add("熊大");
        list.add("熊二");


        Stream<String> stream = list.stream();
        stream.filter(name -> name.startsWith("张"))
                .skip(1)
                .forEach(name -> System.out.println(name));

        List<person> list1 = new ArrayList<>();
        Collections.addAll(list1,
                new person("张三"),
                new person("张三风"),
                new person("熊大"),
                new person("熊三"),
                new person("光头强"));
        list1.stream().map(person -> new Super(person.getName())).forEach(name -> System.out.println(name));
    }
}

